package com.gxa.xc.rbac.controller;


import com.gxa.xc.rbac.dto.ResultDTO;
import com.gxa.xc.rbac.mapper.AdminMapper;
import com.gxa.xc.rbac.pojo.Admin;
import com.gxa.xc.rbac.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashSet;

/*管理员列表*/
@Controller
@RequestMapping("/admin")

public class AdminController {
    @Autowired
    private AdminService adminService;
    @GetMapping("list/page")
public String listpage(){
        return "/admin/admin-list.html";
    }
/*管理员的列表数据*/
    @PostMapping("list/data")
    @ResponseBody
public ResultDTO listData(@RequestParam(defaultValue = "1") Integer page,
                          @RequestParam(defaultValue = "2") Integer pageSize){
        return adminService.list(page,pageSize);
}
    /*管理员添加页面*/
    @GetMapping ("/add/page")
    public String addPage(){
        return "/admin/admin-add";
    }
/*管理员数据添加*/
    @PostMapping("/add/data")
    @ResponseBody
public ResultDTO add(Admin admin){
    return adminService.add(admin);
}


}
